package com.fsnbigdata.service.impl;
import com.fsnbigdata.service.api.IntroductionService;
import org.springframework.roo.addon.layers.service.annotations.RooServiceImpl;
import com.fsnbigdata.domain.Introduction;
import com.fsnbigdata.domain.PlantConservation;
import com.fsnbigdata.repository.IntroductionRepository;
import io.springlets.data.domain.GlobalSearch;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * = IntroductionServiceImpl
 *
 * TODO Auto-generated class documentation
 *
 */
@RooServiceImpl(service = IntroductionService.class)
@Service
@Transactional(readOnly = true)
public class IntroductionServiceImpl implements IntroductionService {

    /**
     * TODO Auto-generated attribute documentation
     *
     */
    private IntroductionRepository introductionRepository;

    /**
     * TODO Auto-generated constructor documentation
     *
     * @param introductionRepository
     */
    @Autowired
    public IntroductionServiceImpl(IntroductionRepository introductionRepository) {
        setIntroductionRepository(introductionRepository);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return IntroductionRepository
     */
    public IntroductionRepository getIntroductionRepository() {
        return introductionRepository;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param introductionRepository
     */
    public void setIntroductionRepository(IntroductionRepository introductionRepository) {
        this.introductionRepository = introductionRepository;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param entity
     * @return Introduction
     */
    @Transactional
    public Introduction save(Introduction entity) {
        return getIntroductionRepository().save(entity);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param id
     * @return Introduction
     */
    public Introduction findOne(Long id) {
        return getIntroductionRepository().findOne(id);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param id
     * @return Introduction
     */
    public Introduction findOneForUpdate(Long id) {
        return getIntroductionRepository().findOneDetached(id);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param ids
     * @return List
     */
    public List<Introduction> findAll(Iterable<Long> ids) {
        return getIntroductionRepository().findAll(ids);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param plantConservation
     * @param globalSearch
     * @param pageable
     * @return Page
     */
    public Page<Introduction> findByPlantConservation(PlantConservation plantConservation, GlobalSearch globalSearch, Pageable pageable) {
        return getIntroductionRepository().findByPlantConservation(plantConservation, globalSearch, pageable);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @param plantConservation
     * @return Long
     */
    public long countByPlantConservation(PlantConservation plantConservation) {
        return getIntroductionRepository().countByPlantConservation(plantConservation);
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return Class
     */
    public Class<Introduction> getEntityType() {
        return Introduction.class;
    }

    /**
     * TODO Auto-generated method documentation
     *
     * @return Class
     */
    public Class<Long> getIdType() {
        return Long.class;
    }
}
